﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BI.CF.BLL;
using BI.CF.Model;

namespace BackStage.Hand
{
    /// <summary>
    /// Authonym_Uptashx 的摘要说明
    /// </summary>
    public class Authonym_Uptashx : IHttpHandler
    {
        Autonym_BLL bll = new Autonym_BLL();
        /// <summary>
        /// 实名认证通过 方法
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            AutonymModel m = new AutonymModel();
            int id = int.Parse( context.Request["id"]);
            m=bll.Autonym_SeleID(id);
            if (m.RealNameState == true)
            {
                m.TID = id;
                m.RealNameState = false;
                m.CerfiticationTime = DateTime.Now;
                if (bll.Autonym_Upt(m) == true)
                {
                    context.Response.Write(1);
                }
                else
                {
                    context.Response.Write(0);
                }
            }
            else
            {
                m.TID = id;
                m.RealNameState =true ;
                m.CerfiticationTime = DateTime.Now;
                if (bll.Autonym_Upt(m) == true)
                {
                    context.Response.Write(1);
                }
                else
                {
                    context.Response.Write(0);
                }
            }
            
            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}